from langchain.document_loaders import CSVLoader

def csv_loader_normal():
    loader = CSVLoader(file_path="files/mlb_teams_2012.csv")
    data = loader.load()
    print(data)


# Customizing the csv parsing and loading
def custom_csv_loader():
    loader = CSVLoader(file_path="files/mlb_teams_2012.csv", csv_args={
        'delimiter': ",",
        "quotechar": '"',
        "fieldnames": ["MLB Team", "Payroll in millions", "Wins"]
    })
    data = loader.load()
    print(data)


def identify_colum_csv_loader():
    # 指定用于标识文档来源的列
    loader = CSVLoader(file_path="files/mlb_teams_2012.csv", source_column="Team")
    data = loader.load()
    print(data)


if __name__ == '__main__':
    identify_colum_csv_loader()